package com.itheima.Demo;

import java.lang.reflect.Constructor;

public class Demo反射构造方法01 {
    public static void main(String[] args) throws NoSuchMethodException {
        //反射相当于是在对类进行解剖

        //获取字节码对象
        Student stu = new Student();
        Class<? extends Student> c1 = stu.getClass();
        //获取所有公共构造方法
        //万物皆对象
        Constructor<? extends Student> con = c1.getConstructor();
        System.out.println(con);
        Constructor<?>[] con1 = c1.getConstructors();
        for (Constructor<?> con2 : con1) {
            System.out.println(con2);
        }
        Constructor<? extends Student> con3 = c1.getConstructor(String.class, int.class);
        System.out.println(con3);
    }
}
